package com.scjp_Java6.ExceptionHandling;

/*
 * Create three new types of exceptions. Write a class with a method that throws all three.
 *	In main( ), call the method but only use a single catch clause that will catch all three types of exceptions.
 *  Write code to generate and catch an ArrayIndexOutOfBoundsException.
 */
public class TIJ_Ex_7 {

	void f() throws MyException3 {
		
			try {
				throw new MyException("First Exception");
				
			} catch (MyException e) {
				try {
					throw new MyException3("My third Exception");
				} catch (MyException3 e2) {
					throw new MyException2("my second exception");
				}
			}
			
	}

	public static void main(String[] args) {
		try {
			new TIJ_Ex_7().f();
		} catch (MyException | MyException2   e) {
//			e.getMessage();
			e.showMessage();
		} catch (MyException3 e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
	}
}
